home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1993 / MacHack 1993.toast / MacHack™ 1987-1992 / MacHack™ '90 / Other Stuff / Demos ƒ / Demo AppMaker / Demo AppMaker™ / Demo AppMaker™.rsrc / TmpP_108_ModelessDialog < prev    next >
Encoding:
Text File  |  1990-03-23  |  2.6 KB  |  133 lines

  1. { %filename% -- modeless dialog }
  2. { Created %date% %time% by AppMaker }
  3.  
  4. Unit %unitname%;
  5. Interface
  6.  
  7. Uses
  8. %if lang = MPW%
  9.     {$Load ToolBox.dump}
  10.         MemTypes,
  11.         QuickDraw,
  12.         OSIntf,
  13.         ToolIntf,
  14.         PackIntf,
  15.     {$Load}
  16.  
  17. %end if%
  18. %if lang = Think%
  19. {$ifc undefined Think_Pascal}
  20.     ListManager,
  21. {$endc}
  22. %end if%
  23.     ResourceDefs,
  24.     DialogAids;
  25.  
  26. Type
  27.     %dlogname%Rec        = record
  28.         %for each item gen dialog field%
  29.     end;
  30.     %dlogname%Ptr        = ^%dlogname%Rec;
  31.     %dlogname%Handle    = ^%dlogname%Ptr;
  32.     
  33. Var
  34.     %dlogname%Dialog:    DialogPtr;
  35.  
  36. {----------}
  37. Procedure Init%dlogname%;
  38. Procedure Do%dlogname%;
  39. Procedure Close%dlogname%;
  40. Function  Filter%dlogname%    (whichDialog:    DialogPtr;
  41.                      var event:            EventRecord;
  42.                      var itemHit:        integer): boolean;
  43. Procedure Do%dlogname%Item (itemNr:        integer);
  44.  
  45. {----------}
  46. Implementation
  47.  
  48. %if lang = MPW%
  49. {$D+}
  50. {$R+}
  51. {$OV+}
  52.  
  53. %end if%
  54. const
  55.     %for each item gen itemNr%
  56.  
  57. %if lang = MPW%
  58. {$S %unitname%}
  59.  
  60. %end if%
  61. %for each item gen auxiliary%
  62.  
  63. {----------}
  64. Procedure Init%dlogname%;
  65. var
  66.     theDialog:        DialogPtr;
  67.     %dlogname%Data:        %dlogname%Handle;
  68. Begin
  69.     %dlogname%Dialog := GetNewDialog (%dlogname%ID, nil, pointer (-1));
  70.     theDialog := %dlogname%Dialog;
  71.     SetPort (theDialog);
  72.     %dlogname%Data := %dlogname%Handle (NewHandle (sizeof (%dlogname%Rec)));
  73.     SetWRefCon (theDialog, longint (%dlogname%Data));
  74.     HLock (Handle (%Dlogname%Data));
  75.     with %dlogname%Data^^ do begin
  76.         %for each item gen init field%
  77.         %for each item gen set%
  78.         %for each item gen enable%
  79.     end; {with}
  80.     HUnlock (Handle (%Dlogname%Data));
  81. End; {Init%dlogname%}
  82.  
  83. {----------}
  84. Procedure Do%dlogname%;
  85. Begin
  86.     if %dlogname%Dialog <> nil then begin
  87.         SelectWindow (%dlogname%Dialog);
  88.         ShowWindow (%dlogname%Dialog);
  89.     end; {if}
  90. End; {Do%dlogname%}
  91.  
  92. {----------}
  93. Procedure Close%dlogname%;
  94. Begin
  95.     HideWindow (%dlogname%Dialog);
  96. End; {Close%dlogname%}
  97.  
  98. {----------}
  99. Function Filter%dlogname%    {(whichDialog:    DialogPtr;
  100.                       var event:        EventRecord;
  101.                       var itemHit:        integer): boolean};
  102. var
  103.     filtered:        boolean;
  104. Begin
  105.     filtered := false;
  106.     %for each item gen filter%
  107.     if not filtered then begin
  108.         filtered := StandardFilter (whichDialog, event, itemHit);
  109.     end;
  110.     Filter%dlogname% := filtered;
  111. End; {Filter%dlogname%}
  112.  
  113. {----------}
  114. Procedure Do%dlogname%Item {(itemNr:    integer)};
  115. Var
  116.     theDialog:        DialogPtr;
  117.     %dlogname%Data:        %dlogname%Handle;
  118. Begin
  119.     theDialog := %dlogname%Dialog;
  120.     SetPort (theDialog);
  121.     %dlogname%Data := %dlogname%Handle (GetWRefCon (theDialog));
  122.     HLock (Handle (%Dlogname%Data));
  123.     with %dlogname%Data^^ do begin
  124.         case itemNr of
  125.             %for each item gen hit%
  126.         end; {case}
  127.         %for each item gen enable%
  128.     end; {with}
  129.     HUnlock (Handle (%Dlogname%Data));
  130. End; {Do%dlogname%Item}
  131.  
  132. End. {%unitname%}
  133.